package map;

import java.util.HashMap;
import java.util.Map;

public class MapDemo1 {
    public static void main(String[] args) {
        Map<String,Integer>map=new HashMap<>();
        Integer value=map.put("语文",99);
        map.put("语文",100);
        map.put("数学",99);
        map.put("英语",98);
        map.put("物理",97);
        map.put("化学",96);
        System.out.println(map);
        map.put("物理",95);
        value =map.put("物理",95);
        System.out.println(map);
        System.out.println(value);

        value=map.get("语文");
        System.out.println(value);
        value=map.get("体育");
        System.out.println(value);

        System.out.println("size:"+map.size());
        System.out.println("isEmpty:"+map.isEmpty());

        System.out.println("是否包含99这个值:"+map.containsKey("数学"));
        System.out.println("是否包含99这个值:"+map.containsValue(99));

        value=map.remove("数学");
        System.out.println(map);
        System.out.println(value);

        map.clear();
        System.out.println(map);
    }
}
